package com.motu.monstercity.server.game.logic;

import com.motu.monstercity.server.game.userdata.*;
import com.motu.vertx.module.utility.model.EntityManager;
import com.motu.vertx.module.utility.model.Model;

import java.util.ArrayList;
import java.util.List;

public class ActUserData extends  ActBaseData{

    public static UserSign getUserSign(long userId) {
        return (UserSign) EntityManager.getUniqueEntity(UserSign.class, userId);
    }

    /**
     * 获取玩家活动信息
     * @param userId
     * @param actId
     * @return
     */
    public static UserAct getUserAct(long userId, long actId){
        return (UserAct) EntityManager.getEntity(UserAct.class, userId, actId);
    }

    public static List<UserAct> getUserActList(long userId) {
        List<Model> modelList = EntityManager.getEntityList(UserAct.class, userId);
        List<UserAct> userActs = new ArrayList<>();
        for (Model model : modelList) {
            UserAct userAct = (UserAct) model;
            if (userAct.isOpen()) {
                userActs.add((UserAct) model);
            }
        }
        return userActs;
    }


    public static UserCommonAct getUserCommonAct(long userId) {
        return (UserCommonAct) EntityManager.getUniqueEntity(UserCommonAct.class, userId);
    }

    public static UserDailySign getUserDailySign(long userId) {
        return (UserDailySign) EntityManager.getUniqueEntity(UserDailySign.class, userId);
    }

    public static UserActDailyScreen getUserActDailyScreen(long userId) {
        return (UserActDailyScreen) EntityManager.getUniqueEntity(UserActDailyScreen.class, userId);
    }

    public static UserDailyRaffleDraw getUserDailyRaffleDraw(long userId) {
        return (UserDailyRaffleDraw) EntityManager.getUniqueEntity(UserDailyRaffleDraw.class, userId);
    }

    public static UserActDailySupply getUserActDailySupply(long userId) {
        return (UserActDailySupply) EntityManager.getUniqueEntity(UserActDailySupply.class, userId);
    }

    // 高级签到
    public static UserDailyPass getUserDailyPass(long userId) {
        return (UserDailyPass) EntityManager.getUniqueEntity(UserDailyPass.class, userId);
    }
}
